import java.util.Arrays;

public class Solution {
    public String largestNumber(int[] nums) {
        int len = nums.length;

        String[] strs = new String[len];

        for (int i = 0; i < len; i++) {
            strs[i] = nums[i] + "";
        }

        Arrays.sort(strs, (a, b) -> {
            return (b + a).compareTo(a + b);
        });

        StringBuilder ret = new StringBuilder();

        for (String s : strs) {
            ret.append(s);
        }

        return ret.charAt(0) == '0' ? "0" : ret.toString();
    }
}
